<!DOCTYPE html>
<html lang='cn' xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title>欢迎登录商城后台管理页面</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
    <meta content="" name="description"/>
    <meta content="" name="author"/>
    <script>
        if (window != top)
            top.location.href = location.href;
    </script>
    <link rel="shortcut icon" th:href="@{/image/walmart.png}" type="image/x-icon"/>
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/bootstrap-responsive.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/style-metro.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/style.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/style-responsive.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/default.css}" rel="stylesheet" type="text/css" id="style_color"/>
    <link th:href="@{/css/uniform.default.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/login.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/local css/index.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/local js/index.js}" type="text/javascript"></script>
</head>

<body class="login">
<div style="position: absolute; left: 0; right: 0; z-index: -1">
       <img th:src="@{/image/18.jpg}"/>
</div>
<div style="height:200px">
</div>
<div style="width:312px;height:300px" class="content">
    <form class="form-vertical login-form" action="login.do" method="post">
        <h3 class="form-title"> 请登录</h3>
        <div class="control-group">
            <label class="control-label visible-ie8 visible-ie9">用户名</label>
            <div class="controls">
                <div class="input-icon left">
                    <i class="icon-user"></i>
                    <input style="height:35px" class="m-wrap placeholder-no-fix" type="text" placeholder="用户名" name="username"/>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label visible-ie8 visible-ie9">密码</label>
            <div class="controls">
                <div class="input-icon left">
                    <i class="icon-lock"></i>
                    <input style="height:35px" class="m-wrap placeholder-no-fix" type="password" placeholder="密码" name="password"/>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label visible-ie8 visible-ie9">验证码</label>
            <div class="controls">
                <div class="input-icon left">
                    <i class="icon-lock"></i>
                    <input style="height:38px;width:124px;float:left" class="m-wrap placeholder-no-fix" type="text" id="input" placeholder="验证码"/>
                    <input style="width: 126px;background-color:deepskyblue" type="button" id="code" onclick="createCode()" title='点击更换验证码' readonly="readonly" value="xxxx"/>
                </div>
            </div>
        </div>
        <div style="text-align: center" class="form-actions">
            <button type="reset" class="btn red ">
                重置
            </button>
            <button id='login' type="submit" class="btn blue pull-right" onclick = "validate()">
                登录
            </button>
        </div>
    </form>
</div>
<div style="text-align: center;padding-top:30px">
    <p style="font-size:30px;color:white">
        扫码登录
    </p>
    <a href="/mall/admin/toLogin.html">
        <img style="height:200px;width:200px;" th:src="@{/image/17.png}"/>
    </a>
</div>
<div class="copyright" style="font-size: 15px;color:black">
    LJQ 2018 &copy; 后台管理系统
</div>
<script th:src="@{/js/jquery-1.10.1.min.js}" type="text/javascript"></script>
<script th:src="@{/js/bootstrap.min.js}" type="text/javascript"></script>
<script th:src="@{/js/app.js}" type="text/javascript"></script>
<script>
    jQuery(document).ready(function () {
        App.init();
        //$("#login").click(login);
    });
    function login() {
        var username = $("[name='username']").val();
        var password = $("[name='password']").val();
        if (!username || !password) {
            alert("用户名密码不能为空！");
            return;
        }
        $.ajax({
            type: "post",
            url: "login.do",
            data: {"username": username, "pwd": password},
            success: function (data) {
                console.log(data);
                if (data.state == 0) {
                    window.location.href = "toIndex.html";
                } else {
                    alert(data.message);
                }
            }
        });
    }
</script>
</body>
</html>